package com.fr.dialog.core;

import com.fr.chart.ChartModule;
import com.fr.dialog.BasicPane;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class ChartCardPane extends BasicPane
{
  private ColorSelectPane colorSelectPane = null;
  private BackgroundPane backgroundPane = null;
  private CardLayout cardLayout;
  private JList dataList;
  private JPanel cardDisplayPane;
  private String[] data = { "填充", "边框颜色", "边框样式", "阴影", "三维格式" };
  private DefaultListModel defaultModel;
  protected ListSelectionListener listSelectionListener = new ListSelectionListener(this)
  {
    private final ChartCardPane this$0;

    public void valueChanged()
    {
      if (ChartCardPane.access$100(this.this$0)[0].equals(ChartCardPane.access$000(this.this$0).getSelectedValue()))
        ChartCardPane.access$300(this.this$0).show(ChartCardPane.access$200(this.this$0), ChartCardPane.access$100(this.this$0)[0]);
      else if (ChartCardPane.access$100(this.this$0)[1].equals(ChartCardPane.access$000(this.this$0).getSelectedValue()))
        ChartCardPane.access$300(this.this$0).show(ChartCardPane.access$200(this.this$0), ChartCardPane.access$100(this.this$0)[1]);
    }
  };

  public ChartCardPane()
  {
    setLayout(new BorderLayout());
    this.cardDisplayPane = new JPanel();
    add(this.cardDisplayPane, "Center");
    this.cardLayout = new CardLayout();
    this.cardDisplayPane.setLayout(this.cardLayout);
    this.colorSelectPane = new ColorSelectPane();
    this.backgroundPane = new BackgroundPane();
    this.cardDisplayPane.add(this.backgroundPane, this.data[0]);
    this.cardDisplayPane.add(this.colorSelectPane, this.data[1]);
    this.defaultModel = new DefaultListModel();
    this.dataList = new JList(this.defaultModel);
    add(this.dataList, "West");
    for (int i = 0; i < this.data.length; ++i)
      this.defaultModel.addElement(this.data[i]);
    this.dataList.setSelectedIndex(0);
    this.dataList.addListSelectionListener(this.listSelectionListener);
  }

  public void populate(ChartModule paramChartModule)
  {
    this.backgroundPane.populate(paramChartModule.getBackground());
  }

  public void update(ChartModule paramChartModule)
  {
    paramChartModule.setBackground(this.backgroundPane.update());
  }

  static JList access$000(ChartCardPane paramChartCardPane)
  {
    return paramChartCardPane.dataList;
  }

  static String[] access$100(ChartCardPane paramChartCardPane)
  {
    return paramChartCardPane.data;
  }

  static JPanel access$200(ChartCardPane paramChartCardPane)
  {
    return paramChartCardPane.cardDisplayPane;
  }

  static CardLayout access$300(ChartCardPane paramChartCardPane)
  {
    return paramChartCardPane.cardLayout;
  }
}